package cn.zhengzhou.springbootmybatis.demo;

import java.util.ArrayList;

public class StringDemo {
    public static void main(String[] args) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("hello");
        stringBuffer.append(" world");
        System.out.println(stringBuffer.toString());
        char[] chars = {'a', 'b', 'c'};
        String s = new String(chars);
        String s2 = new String(chars);
        System.out.println(s==s2);
        String s1 = "s1 = ";
        String s3 = "s1 = 1";
        System.out.println(s.equals(s2));
        System.out.println(s1==s3);


        String phone = "18238265825";
        String newphone = phone.substring(0,3)+"****"+phone.substring(7);
        System.out.println(newphone);
        String replace = phone.replace("3825", "****");
        System.out.println(replace);

        ArrayList<Object> list = new ArrayList<>();
        list.add("hello");
        list.add("world");
        System.out.println(list);
        int hello = list.size();
        System.out.println(hello);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

    }
}
